﻿using YookingBizYQ.Class.Public;
using YookingFileIO.Class;


namespace YookingBizYQ
{
    public class clsMain
    {
        //注释：王庆文 2019年12月16日=================================================================
        /// <summary>
        /// 根据RequestID，分别执行不同的数据读取任务，得到相应条件的信息记录集合
        /// </summary>
        /// <param name="strRequestID">客户端请求ID</param>
        /// <param name="strRequestData">客户端请求参数集合</param>
        /// <returns>返回数据读取、分析、处理结果</returns>
        public string ReadDataFromServer(string strRequestID, string strRequestData)
        {
            string strResult = "no data"; //数据读取、分析、处理结果

            clsYaraApi YaraApi = new clsYaraApi();

            //clsSFZ mySFZ = new clsSFZ();         
            if (strRequestID.ToUpper() == "PengShuai20191221150601".ToUpper())
            {
                ////直接从服务器端读取“民族”字典数据
                //strResult = mySFZ.GetMZDictionary(strRequestData);
            }
            else if (strRequestID.ToUpper() == "PengShuai20191221220901".ToUpper())
            {
                ////模糊查询符合条件的身份证数据信息
                //strResult = mySFZ.GetSFZInfo(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi20240914131101".ToUpper())
            {

                //该方法为开发环境调试 查询类 SQL语句使用 ，不作生产环境使用
                strResult = YaraApi.GetList(strRequestData);
            }
            // ==================资产类别管理页面相关接口=======================
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi20240914131201".ToUpper())
            {
                //查询资产分类一级列表
                strResult = YaraApi.GetPreantTypePropertyList(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202409221433".ToUpper())
            {
                //查询资产分类列表详情
                strResult = YaraApi.GetTypePropertyList(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202409221520".ToUpper())
            {
                //查询资产类别列表
                strResult = YaraApi.GetTypePropertyNameList(strRequestData);
            }
            // ==================资产采购管理页面相关接口=======================
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202409222020".ToUpper())
            {
                //分页查询资产采购列表
                strResult = YaraApi.GetBuyPropertyList(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi20240922202011".ToUpper())
            {
                //分页查询资产采购列表
                strResult = YaraApi.GetDepTypeP(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202409242103".ToUpper())
            {
                //导出资产采购列表
                strResult = YaraApi.ExportBuyPropertyList(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi2024092420012".ToUpper())
            {
                //登录logo
                strResult = YaraApi.GetLoginlog(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202409242211".ToUpper())
            {
                //根据采购ID获取采购单详情(查看按钮)
                strResult = YaraApi.GetBuyPropertyInfoByBuyID(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202409252136".ToUpper())
            {
                //根据采购ID获取待签收单
                strResult = YaraApi.GetAwaitingDeliveryListByBuyID(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202409301130".ToUpper())
            {
                //资产采购申请单打印接口
                strResult = YaraApi.GetApplyNote(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202409301150".ToUpper())
            {
                //资产采购签收单打印接口
                strResult = YaraApi.GetSignForNote(strRequestData);
            }
            // ==================资产明细管理页面相关接口=======================
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202409301515".ToUpper())
            {
                //获取资产明细列表
                strResult = YaraApi.GetPropertyDetailList(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202409301616".ToUpper())
            {
                //根据资产id查询转移记录
                strResult = YaraApi.GetTransferLogByDetailID(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202409301630".ToUpper())
            {
                //根据资产id查询维修记录
                strResult = YaraApi.GetRepairByDetailID(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202409301700".ToUpper())
            {
                //导出资产明细表
                strResult = YaraApi.ExportPpropertyDetail(strRequestData);
            }
            // ======================发放管理页面相关接口=====================
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202409301710".ToUpper())
            {
                //分页获取资产发放数据列表
                strResult = YaraApi.GetFixedGrantList(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202410091118".ToUpper())
            {
                //导出发放管理列表数据
                strResult = YaraApi.ExportFixedGrantList(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202410091120".ToUpper())
            {
                //发放管理申请单打印
                strResult = YaraApi.GetGrantForNote(strRequestData);
            }
            // ======================报修管理页面相关接口=====================
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202410091130".ToUpper())
            {
                //分页获取报修数据列表
                strResult = YaraApi.GetFixedRepairLogList(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202410091150".ToUpper())
            {
                //导出报修数据列表
                strResult = YaraApi.ExportFixedRepairLogList(strRequestData);
            }
            // ======================报废管理页面相关接口=====================
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202411121520".ToUpper())
            {
                //分页获取报废总表
                strResult = YaraApi.GetYaraScrapSetList(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202506261205".ToUpper())
            {
                // 代办中的审批报废列表
                strResult = YaraApi.GetSPYaraScrapSetList(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202410091355".ToUpper())
            {
                //分页获取报废明细数据列表
                strResult = YaraApi.GetYaraScrapList(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202410091420".ToUpper())
            {
                //导出报废数据列表
                strResult = YaraApi.ExportYaraScrapList(strRequestData);
            }

            // ======================转移管理页面相关接口=====================
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202411121718".ToUpper())
            {
                //分页获取转移总表
                strResult = YaraApi.GetYaraTransferSetList(strRequestData);
            }

            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202410091500".ToUpper())
            {
                //分页获取转移数据列表
                strResult = YaraApi.GetFixedTransferLogList(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202410091520".ToUpper())
            {
                //导出转移数据列表
                strResult = YaraApi.ExportFixedTransferLogList(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202410091530".ToUpper())
            {
                //获取转移申请单
                strResult = YaraApi.GetFixedTransferLogApply(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202410091555".ToUpper())
            {
                //获取转移签收单
                strResult = YaraApi.GetFixedTransferLogReceipt(strRequestData);
            }

            // ======================消息列表页面接口=====================
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202410101051".ToUpper())
            {
                //分页获取消息列表数据
                strResult = YaraApi.GetYaraMessageList(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202410101130".ToUpper())
            {
                //导出消息列表数据
                strResult = YaraApi.ExportYaraMessageList(strRequestData);
            }

            //========================= 盘点设置 =============
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202411111111".ToUpper())
            {
                // 分页获取盘点设置列表数据
                strResult = YaraApi.GetYaraInventorySetList(strRequestData); 
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202506272345".ToUpper())
            {
                // 得到盘点主表中的盘点号码
                strResult = YaraApi.GetInventorySetListByUnitCode(strRequestData); 
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202411111555".ToUpper())
            {
                //盘点 立即执行
                strResult = YaraApi.ZhiXingYaraInventorySet(strRequestData);
            }

            // ======================盘点管理页面接口=====================
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202410291350".ToUpper())
            {
                // 分页获取盘点管理列表数据
                strResult = YaraApi.GetYaraInventoryInfoList(strRequestData);
            }

            // ======================首页接口=====================
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202410291520".ToUpper())
            {
                // 获取首页数据GetHomePageData
                strResult = YaraApi.GetHomePageData(strRequestData);
            }
            // ======================广告轮播图接口=====================
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202410301630".ToUpper())
            {
                // 获取广告类轮播图列表
                strResult = YaraApi.GetYaraAdList(strRequestData);
            }
            // ======================资讯类轮播图接口=====================
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202410302025".ToUpper())
            {
                // 获取资讯类轮播图列表
                strResult = YaraApi.GetYaraInformationList(strRequestData);
            }
            //========================发送模版消息  ==================================
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202411051142".ToUpper())
            {
                // 获取资讯类轮播图列表
                strResult = YaraApi.SendTemplateMessaage(strRequestData);
            }
            //========================获取部门  ==================================
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202411191500".ToUpper())
            {
                // 获取部门树列表
                strResult = YaraApi.GetDeptTreeList(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202411191501".ToUpper())
            {
                // 同步部门人员到表 yara_dep_per
                strResult = YaraApi.SynPersonToDep(strRequestData);
            }

            //========================= 审批流方法 =============
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202411201200".ToUpper())
            {
                // 获取审批流列表
                strResult = YaraApi.GetSPList(strRequestData);
            }
            //========================= 发送邮件 =============
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202411212121".ToUpper())
            {
                // 发送邮件
                strResult = YaraApi.SendEmail(strRequestData);
            }
            //=============== 根据资产类别和采购类型生成资产编号 =======================
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202411221631".ToUpper())
            {
                // 根据资产类别和采购类型生成资产编号
                strResult = YaraApi.GetZCNo(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202411221510".ToUpper())
            {
                // 获取批量发送邮件人员列表
                strResult = YaraApi.GetBatchSendEmailList(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202411221035".ToUpper())
            {
                // 获取所有人员部分信息列表
                strResult = YaraApi.GetPersonInfoList(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202503191540".ToUpper())
            {
                // 获取转移/报废/采购等审批状态的数量
                strResult = YaraApi.GetCountStatusNum(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202506102256001".ToUpper())
            {
                // 获取待办中的采购列表，仅显自己相关的by PresonID
                strResult = YaraApi.GetBuySPList(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202506291917".ToUpper())
            {
                // 获取待办中的采购列表，仅显自己相关的by PresonID
                strResult = YaraApi.RunTask(strRequestData);
            }

            return strResult; //得到符合条件的查询结果
        }


        //注释：王庆文 2019年12月16日===============================================================
        /// <summary>
        /// 根据RequestID，分别执行不同的数据insert或update任务，并将处理结果反馈给客户端
        /// </summary>
        /// <param name="strRequestID">客户端请求ID</param>
        /// <param name="strRequestData">客户端请求参数集合</param>
        /// <returns>反馈数据insert或update处理结果</returns>
        public string WriteDataToServer(string strRequestID, string strRequestData)
        {
            string strResult = "no data"; //数据读取、分析、处理结果
            clsYaraApi YaraApi = new clsYaraApi();
            clsHandleData myWrt = new clsHandleData();
            if (strRequestID.ToUpper() == "PengShuai20191221150801".ToUpper())
            {
                //解析和处理客户端发过来的要求服务器必须处理的数据，
                //先解密、再解码、再解析出一个一个的参数，最后执行写库操作。
                //根据strKeyColSet设置的内容，自动判断insert，还是update
                strResult = myWrt.InsertOrUpdate_ToDB(strRequestData);
            }
            else if (strRequestID.ToUpper() == "PengShuai20191221223601".ToUpper())
            {
                //删除指定指定数据库表中指定Sys_RecordID的记录
                strResult = myWrt.CancelDataForRecordID(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202409211344".ToUpper())
            {

                //添加 或者 修改
                strResult = YaraApi.InsertOrUpdate(strRequestData);
            }

            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202409212302".ToUpper())
            {

                //删除
                strResult = YaraApi.CancelDataForRecordID(strRequestData);
            }
            //--------------- 设置财务总监或者总经理 -----------------------
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi202411192120".ToUpper())
            {

                //设置财务总监或者总经理
                strResult = YaraApi.SetCWZJL(strRequestData);
            }
            else if (strRequestID.ToUpper() == "Plugin_YookingBizYQ_YangQi2024111921QX".ToUpper())
            {

                //设置财务总监或者总经理
                strResult = YaraApi.SetGLYQX(strRequestData);
            }

            return strResult; //得到符合条件的查询结果
        }



    }
}
